home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza 7 / Shareware Extravaganza 8 (Most Significant Bits) (Disc 7).iso / win95b / wb32-96a.zip / DOSERROR.WB_ < prev    next >
Text File  |  1994-08-28  |  935b  |  30 lines

  1. ; DOS Errorlevel Code courtesy of Neil Rubenking, PC Magazine
  2. if Param0==0
  3.     Message("Information","DOSERROR.WBT shows how to get an errorlevel back into WinBatch from a DOS application.  Inspect file for more information.")
  4.     exit
  5. endif
  6.  
  7. ;This WBT file works in conjunction with the DOSERROR.BAT file also
  8. ;in the sample directory.  Run the DOS program via the DOSERROR.BAT
  9. ;file, and the pick the errorlevel out of the result.
  10. ;Example
  11.  
  12.  
  13. DosProgram="Bananna.com"                         ; Some DOS Program
  14. DosParms="-w -xfred.dat '47 BumbleBee St'"       ; Assorted random parameters
  15.  
  16. RunWait("DOSERROR.BAT",strcat(DosProgram, " ", DosParms))
  17.  
  18. a=FileItemize("ERROR*.LVL")
  19. if ItemCount(a," ") !=1 
  20.    Message("Errorlevel Reporting Problem","Multiple ERRORxxxLVL files exist")
  21.    exit
  22. endif
  23.  
  24. a=ItemExtract(1,a," ")
  25. a=FileRoot(a)
  26. errorlevel=strsub(a,6,strlen(a)-5)
  27.  
  28. Message("ErrorLevel is",errorlevel)
  29.  
  30.